$(function () {
  var height = function () {
    var wHeight = $(window).innerHeight()
    if (wHeight >= 800)
      $('.login_bg').css('height',wHeight - 150 + "px")
  }
  height()
  $(".agreenment").click(function () {
    $(".cover").css("display", "block")
  })
  $(".cancel").click(function () {
    $(".cover").css("display", "none")
  })
  // 获取验证码
  var codeFlag = true
  $(".get-code").click(function () {
    if (codeFlag) {
      codeFlag = false
      var timer = 60
      var intval = setInterval(function () {
        if (timer <= 0) {
          $(".get-code").html("重新发送")
          clearInterval(intval)
          codeFlag = true
          $(".get-code").css({
            "color" : "#3C6AD9",
            "background": "#fff"
          })
        } else {
          var text = "已发送"
          if (timer < 10) {
            text = "已发送0"
          }
          $(".get-code").html(text + timer)
          $(".get-code").css({
            "color" : "#666",
            "background": "#ddd"
          })
          timer--
        }
      }, 1000)
    }
  })
})

// 验证手机号
var isMobil = function (mobile) {
  return /^1[345789]\d{9}$/.text(mobile)
}